package com.senyint.imsdk.packet;

import org.jivesoftware.smack.packet.IQ;

public class AttachmentIQ extends IQ {

    /**
	 * 
	 */
	private static final long serialVersionUID = -1111075639103530292L;
	/* the data packet extension */
    private final AttachmentPacketExtension data;

    /**
     * Constructor.
     * 
     * @param data data packet extension containing the encoded data
     */
    public AttachmentIQ(AttachmentPacketExtension data) {
        if (data == null) {
            throw new IllegalArgumentException("Data must not be null");
        }
        this.data = data;

        /*
         * also set as packet extension so that data packet extension can be
         * retrieved from IQ stanza and message stanza in the same way
         */
        addExtension(data);
        setType(IQ.Type.SET);
    }

    public AttachmentPacketExtension getAttachmentPacketExtension() {
        return this.data;
    }

    public String getChildElementXML() {
        return this.data.toXML();
    }

}
